$serverName = "SQLServerTrainingKitAlias"
$utilityName = "Contoso Utility"

$server = New-Object Microsoft.SqlServer.Management.Smo.Server($serverName);
$server.ConnectionContext.LoginSecure = $true;
$server.ConnectionContext.Connect();

$sqlStoreConnection = New-Object Microsoft.SqlServer.Management.Sdk.Sfc.SqlStoreConnection($server.ConnectionContext.SqlConnectionObject);

if ([Microsoft.SqlServer.Management.Utility.Utility]::IsUtilityControlPoint($sqlStoreConnection))
{
	Write-Host "There is already an UCP for the server $serverName";
	return 0;
}

$Utility = [Microsoft.SqlServer.Management.Utility.Utility]::CreateUtility($utilityName, $SqlStoreConnection);

if (!$?)
{
	throw "An error has occurred trying to create the $utilityName UCP";
}
else
{
	Write-Host "The $utilityName UCP was successfully created";
}